using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Beaker.OpenCube.CubeManager.Model.Framework;
using Beaker.OpenCube.CubeManager.Model.Interfaces;

namespace Beaker.OpenCube.CubeManager.Model.Entities
{
	public class Activity
		: Entity, INamed
	{
		private readonly EntitySet<Role, Activity> _roles;

		public Activity( string activityName )
			: this()
		{
			Name = activityName;
		}

		internal Activity()
		{
			_roles = new EntitySet<Role, Activity>( this, role => role.Activities );
		}

		/// <summary>
		/// Gets the name of this role.
		/// </summary>
		/// <value>
		/// The name of this role.
		/// </value>
		[StringLength( 64 )]
		[Required]
		public string Name { get; internal set; }

		/// <summary>
		/// Gets the set of roles that have this activity assigned.
		/// </summary>
		/// <value>
		/// The set of roles that have this activity assigned.
		/// </value>
		public ISet<Role> Roles
		{
			get { return _roles; }
		}
	}
}